home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-03
/
bounce.zip
/
BOUNCE.BAS
< prev
next >
Wrap
BASIC Source File
|
1990-11-21
|
6KB
|
186 lines
'Bounce.BAS Jim Paisley 10690 Allen Rd NW Washington C.H., Oh, 43160
'-------------------subs from WMouse.OBJ---------------------------
DECLARE SUB ShowM : 'see note at end of this program
DECLARE SUB HideM
DECLARE SUB MButton (l%, r%) : 'returned as true/false
DECLARE SUB MLoc (r%, c%) : ' r% = 0 to 199 c% = 0 to 639
DECLARE SUB SetMLoc (r%, c%)
DECLARE SUB InitM (Present%) : ' -1 if mouse driver not present
'-------------- subs from QB4Win32.ZIP ------------------------------
'$INCLUDE: 'W32.DEC'
'----------------------------------------------------------------------
SCREEN 0
COLOR 2, 0: CLS
InitM p%: IF p% <> -1 THEN PRINT "No Mouse installed": END
'-----------------------------------------------------------------------
MainProgram:
fore = 0: back = 3: Bright = 11
Kolor fore, back: Lokate 1, 1:
Prnt " File " + CHR$(10)
'print directions
COLOR 2, 0: LOCATE 22, 1
PRINT "Press Alt-F for the file menu, or place the mouse ";
PRINT "over 'File' and click the left button"
ShowM
DO UNTIL i$ = CHR$(0) + CHR$(33): 'alt-F
i$ = INKEY$
MButton LB%, RB%: GOSUB PrintButton
MLoc r%, c%
c% = c% / 8 + 1: r% = r% / 8 + 1
GOSUB PrintLocation
IF LB% AND r% = 1 AND c% < 20 THEN EXIT DO
LOOP
'Erase the directions
Kolor 2, 0: Lokate 22, 1: Prnt CHR$(13): Prnt CHR$(10)
'-----------------------------------------------------
FileMenu:
Up$ = CHR$(0) + CHR$(72): Down$ = CHR$(0) + CHR$(80)
lft$ = CHR$(0) + CHR$(75): rght$ = CHR$(0) + CHR$(77)
Selection = 1
REDIM Msg$(1 TO 7)
Msg$(1) = " Load File"
Msg$(2) = " Save File"
Msg$(3) = " Merge File"
Msg$(4) = ""
Msg$(5) = " Print"
Msg$(6) = " Dos Shell"
'--------------------------------------------------------------------------
'Save the screen under the menu
REDIM Temp%(500)
Kolor fore, back
Border 1
CALL HideM: SaveW VARSEG(Temp%(1)), 2, 10, 9, 24: ShowM
'--------------------------------------------------------------------------
PrintMenu:
'wrap from top to bottom of the menu
IF Selection = 0 THEN Selection = 6
IF Selection = 7 THEN Selection = 1
IF Selection = 4 AND i$ = Up$ THEN Selection = 3
IF Selection = 4 AND i$ = Down$ THEN Selection = 5
'print the menu
HideM
Kolor fore, back
Border 1
OpenW 0, 2, 10, 9, 24
FillW 0, VARPTR(Msg$(1))
'Highlight the hot key for each item
COLOR Bright, back
LOCATE 3, 12, 0: PRINT "L";
LOCATE 4, 12, 0: PRINT "S";
LOCATE 5, 12, 0: PRINT "M";
LOCATE 7, 12, 0: PRINT "P";
LOCATE 8, 12, 0: PRINT "D";
'draw an extra line between the two areas
COLOR fore, back
LOCATE 6, 10, 0: PRINT "├─────────────┤"
'highlight the current selection
COLOR 11, 4
IF Selection = 1 THEN LOCATE 3, 11: PRINT " Load File "
IF Selection = 2 THEN LOCATE 4, 11: PRINT " Save File "
IF Selection = 3 THEN LOCATE 5, 11: PRINT " Merge File "
IF Selection = 5 THEN LOCATE 7, 11: PRINT " Print "
IF Selection = 6 THEN LOCATE 8, 11: PRINT " Dos Shell "
'turn the mouse back on
ShowM
'wait until the mouse button is lifted
DO UNTIL NOT LB%: MButton LB%, RB%: GOSUB PrintButton: LOOP
'--------------------------------------------------------------------------
WaitFor:
i$ = INKEY$
IF i$ = Up$ THEN Selection = Selection - 1: GOTO PrintMenu
IF i$ = Down$ THEN Selection = Selection + 1: GOTO PrintMenu
IF i$ = CHR$(13) GOTO Execute
i$ = LCASE$(i$)
IF i$ = "l" THEN Selection = 1: GOTO Execute
IF i$ = "s" THEN Selection = 2: GOTO Execute
IF i$ = "m" THEN Selection = 3: GOTO Execute
IF i$ = "p" THEN Selection = 5: GOTO Execute
IF i$ = "d" THEN Selection = 6: GOTO Execute
IF i$ = CHR$(27) THEN Selection = 0: GOTO Execute
MButton LB%, RB%: GOSUB PrintButton
MLoc r%, c%
c% = c% / 8 + 1: r% = r% / 8 + 1
GOSUB PrintLocation
IF NOT LB% GOTO WaitFor: 'Left button not down
IF r% = 3 AND c% >= 10 AND c% <= 24 THEN Selection = 1: GOTO Execute
IF r% = 4 AND c% >= 10 AND c% <= 24 THEN Selection = 2: GOTO Execute
IF r% = 5 AND c% >= 10 AND c% <= 24 THEN Selection = 3: GOTO Execute
IF r% = 7 AND c% >= 10 AND c% <= 24 THEN Selection = 5: GOTO Execute
IF r% = 8 AND c% >= 10 AND c% <= 24 THEN Selection = 6: GOTO Execute
'If L button down (not in the menu box) exit this menu
Selection = 0: GOTO Execute
'--------------------------------------------------------------------------
Execute:
HideM
CloseW VARSEG(Temp%(1)), 2, 10, 9, 24
IF Selection = 1 THEN LOCATE 20, 20: PRINT "Loading File"
IF Selection = 2 THEN LOCATE 20, 20: PRINT "Saving File"
IF Selection = 3 THEN LOCATE 20, 20: PRINT "Merging File"
IF Selection = 5 THEN LOCATE 20, 20: PRINT "Printing "
IF Selection = 6 THEN LOCATE 20, 20: PRINT "Shell"
IF Selection <> 0 THEN FOR n = 1 TO 2000: NEXT
COLOR 2, 0: LOCATE 20, 20: PRINT " "
ShowM
'wait until the mouse button is lifted
DO UNTIL NOT LB%: MButton LB%, RB%: GOSUB PrintButton: LOOP
GOTO MainProgram
'--------------------------------------------------------------------------
PrintButton:
COLOR fore, back
LOCATE 1, 60: IF LB% THEN PRINT "L"; ELSE PRINT " ";
LOCATE 1, 62: IF RB% THEN PRINT "R"; ELSE PRINT " ";
RETURN
PrintLocation:
COLOR fore, back
LOCATE 1, 64: PRINT r%; " ";
LOCATE 1, 68: PRINT c%; " ";
RETURN
'=====================================================================
'ShowM does not directly turn on the mouse cursor display. It increments
'a counter (but only if the counter is < 0) and when that counter is
'0 the mouse is displayed. HideM decrements the counter.
'This counter is part of the device driver. InitM sets it to -1 and
'positions the cursor at the middle of the screen.
'The cursor seems to be turned off when you stop to use the Qbasic editor.
'Hide the cursor when saving a window or printing anything. When it is
'moved it will restore what used to be there.
'This doesn't work with MouseCtl.Com (from PC Magazine)